package com.etone.smartAudit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.etone.smartAudit.domain.AdminRole;
import com.etone.smartAudit.dto.adminMenu.MenuPermissionDTO;
import com.etone.smartAudit.vo.adminRole.AdminRoleListVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author: 蒋学伟
 * @create: 2020-06-07 18:01:45
 * @Description 角色
 */
@Mapper
public interface AdminRoleMapper extends BaseMapper<AdminRole> {
    /**
     * 条件查询AdminRoleListVO
     *
     * @param name
     * @return
     */
    List<AdminRoleListVO> findAdminRoleListVO(@Param("name") String name);

    /**
     * 批量删除管理员权限
     *
     * @param roleId
     * @return
     */
    int deleteRolePermission(@Param("roleId") Integer roleId);

    /**
     * 批量新增管理员权限
     *
     * @param roleId
     * @param menumPDto
     * @return
     */
    int batchInsertPermission(@Param("roleId") Integer roleId, @Param("menumPDto") List<MenuPermissionDTO> menumPDto);

    /**
     * 删除管理员菜单
     *
     * @param roleId
     * @return
     */
    int deleteRoleMenu(@Param("roleId") Integer roleId);

    /**
     * 批量新增管理员菜单
     *
     * @param roleId
     * @param menuIds
     * @return
     */
    int batchInsertMenu(@Param("roleId") Integer roleId, @Param("menuIds") List<Integer> menuIds);

    /**
     * 获取权限的parentIds
     * @param roleId
     * @param permisssionId
     * @return
     */
    List<Map<String,Object>>  getmenuIdsByRoleIdAndPermissionId( @Param("roleId") Integer roleId, @Param("permisssionId") Integer permisssionId);
}
